package com.yueyang.sojourn.server.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author yemingxing
 * @summary 营业状态 枚举
 * @Copyright (c) 2020, Yueyang Group All Rights Reserved.
 * @since 2020-02-13
 */
@AllArgsConstructor
public enum OperStatusEnum implements IEnum {
    /**
     * 营业状态 枚举
     */
    TO_BE_OPENED(0, "待开业"),
    OPENING(1, "营业中"),
    CLOSING(2, "停业中"),
    CLOSED(9, "已关闭"),
    ;

    @Getter
    private int code;

    @Getter
    private String desc;

    public static OperStatusEnum ofCode(Integer code) {
        return Arrays.stream(OperStatusEnum.values()).filter(operStatusEnum -> operStatusEnum.code == code).findFirst().orElse(null);
    }
}
